package com.hyt.it.ogt.kq.service.govData.service.kz.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.kq.service.govData.mapper.kz.ExamPaperMapper;
import com.hyt.it.ogt.kq.service.govData.model.entity.kz.ExamPaper;
import com.hyt.it.ogt.kq.service.govData.service.kz.IExamPaperService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 考试-试卷 服务实现类
 * </p>
 *
 * @author 刘恒活
 * @since 2020-05-15
 */
@Service
public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaperMapper, ExamPaper> implements IExamPaperService {


    /**
     * 通过考试id批量查询
     * @param examIds
     * @return
     */
    @Override
    @DS("kz")
    public Integer countByExamIds(List<String> examIds){
        LambdaQueryWrapper<ExamPaper> queryExamPaperWrapper = Wrappers.lambdaQuery();
        queryExamPaperWrapper.in(ExamPaper::getExamId, examIds)
                .and(i -> i.eq(ExamPaper::getDelFlag, false));
        return this.count(queryExamPaperWrapper);
    }
}
